import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
drive = webdriver.Chrome()
drive.get('http://localhost:8080/WebTest_war_exploded/pages')
time.sleep(2)
element1 = drive.find_element(By.XPATH,'//button[contains(text(),"Alert")]')
element1.click()
time.sleep(2)
drive.switch_to.alert.accept()
time.sleep(2)
element2 = drive.find_element(By.XPATH,'//button[contains(text(),"Confirm")]')
element2.click()
time.sleep(2)
drive.switch_to.alert.accept()
time.sleep(2)
drive.switch_to.alert.accept()
time.sleep(2)
element1 = drive.find_element(By.XPATH,'//button[contains(text(),"Prompt")]')
time.sleep(2)
element1.click()
time.sleep(2)
drive.switch_to.alert.send_keys("hello world！")
time.sleep(2)
drive.switch_to.alert.accept()
time.sleep(2)
drive.switch_to.alert.accept()
time.sleep(2)